class Solution:
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """
        if len(prices) <= 1:
            return 0

        buy = prices[0]
        _max = 0
        for v in prices[1:]:
            _max = max(_max, v - buy)
            if v < buy:
                buy = v
        return _max

s = Solution()
print('ss', s.maxProfit([7,1,5,3,6,4]))
print('ss', s.maxProfit([[7,6,4,3,1]]))

